Frontend Forever App
We have a mobile app for you to download and use. And you can unlock many features in the app.
Get it now
Intall Later
Run
HTML
CSS
Javascript
Output
Document
Edit Text
Edit Size
Edit Outline Thickness
@charset "UTF-8"; @import url(https://fonts.googleapis.com/css?family=Nunito+Sans:300,400,600,700,800); *, :after, :before { box-sizing: border-box; padding: 0; margin: 0; } * { font-family: system-ui; } text { font-size: 30px; font-weight: 900; text-anchor: middle; dominant-baseline: middle; } .controls { margin: 0 auto; width: min-content; } label { display: block; margin-block-end: 1em; font-size: 1.4em; } input { font-size: 1em; padding: .5em; border: .2em solid; border-radius: .5em; text-align: center; margin-block-start: .2em; } #info { position: absolute; right: 0; bottom: 0; width: 200px; text-align: left; }
console.log("Event Fired") console.clear(); const pattern = document.getElementById('diagonalHatch'); const morph = document.getElementById('outline').querySelector("feMorphology"); const inputText = document.getElementById("text"); const inputSize = document.getElementById("size"); const inputThickness = document.getElementById("thickness"); const text = document.querySelector("text"); const getTime = () => (new Date()).getTime(); const start = getTime(); const duration= 2000; let size = 6; let thickness = .1 const setSizes = () => { pattern.setAttribute("width", size); pattern.setAttribute("height", size); morph.setAttribute("radius", size * thickness) pattern.innerHTML = `
` } setSizes(); const updateText = (newText) => text.innerHTML = newText.toUpperCase(); inputText.addEventListener("keyup", (e) =>{ text.innerHTML = updateText(e.target.value) }) inputText.value = "design"; updateText(inputText.value) const updateSize = (newSize) => { size = newSize; setSizes(); } inputSize.value = size; inputSize.addEventListener("change", (e) =>{ updateSize(e.target.value); }) const updateThickness = (newThickness) => { thickness = newThickness; setSizes(); } inputThickness.value = thickness; inputThickness.addEventListener("change", (e) =>{ updateThickness(e.target.value); }) function animate () { requestAnimationFrame(animate); const now = getTime(); const diff = now - start; const t = (diff % duration) / duration; pattern.setAttribute("y", size * -t); } animate();